package com.crm.controller;

import com.crm.entity.Department;
import com.crm.service.DepartmentService;
import com.crm.util.FenyeUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("dep")
public class DepartmentController {

	@Autowired
	private DepartmentService depff;
	
	@GetMapping
	
	public FenyeUtil<Department> Get(Department dep,Integer page){
		return depff.GetMsgByPage(dep, page);
	}
	@DeleteMapping
	@RequiresPermissions("bm:del")
	public String Del(Integer did) {
		return depff.DelDepartment(did);
	}
	@PutMapping
	@RequiresPermissions("bm:update")
	public String Upd(Department dep) {
		return depff.AddAndUpd(dep);
	}
	@PostMapping
	@RequiresPermissions("bm:add")
	public String Add(Department dep) {
		return depff.AddAndUpd(dep);
	}
}
